package com.cndw.kungfu.model.battle;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import com.cndw.kungfu.model.battle.buff.BuffLibI;

public abstract class FighterBase {
	/**
	 * 临时攻速信息
	 */
	private int speed;
	
	private int speedMillis;

	
	protected Fighter lastAttackMe;//上一个攻击我的对象
	protected Fighter lastTarget;//我上次攻击的对象
	
	protected int fixAttack = 0;
	protected int fixDefense = 0;
	protected int fixHit = 0;
	protected int fixDodge = 0;
	protected int fixCrit = 0;
	protected int fixTough = 0;
	/**
	 * buff系数
	 */
	protected int buffCoefficient = 0;
	
	
	protected Map<Integer, BuffLibI> buffMap = new ConcurrentHashMap<Integer, BuffLibI>(6);
	
	
	protected boolean havaFailGoods = false;
	
	public static final int defaultSpeed = 60;
	

	
	abstract public int getSpeed();
	

	
	public int getSpeedMillis() {
		if (speedMillis == 0 || speed != getSpeed() ) {	
			int speed = getSpeed();
			speedMillis = BattleFormula.getSpeed(speed);
		}
		return speedMillis;
	}
	
	public void onDead(Fighter fighter){
		
	}

	public Map<Integer, BuffLibI> getBuffMap() {
		return buffMap;
	}
	
	public Fighter getLastAttackMe() {
		return lastAttackMe;
	}
	public void setLastAttackMe(Fighter lastAttackMe) {
		this.lastAttackMe = lastAttackMe;
	}
	public Fighter getLastTarget() {
		return lastTarget;
	}
	public void setLastTarget(Fighter lastTarget) {
		this.lastTarget = lastTarget;
	}



	public void alterFixAttack(int fixAttack) {
		this.fixAttack += fixAttack;
	}
	public void alterFixDefense(int fixDefense) {
		this.fixDefense += fixDefense;
	}
	public void alterFixHit(int fixHit) {
		this.fixHit += fixHit;
	}
	public void alterFixDodge(int fixDodge) {
		this.fixDodge += fixDodge;
	}
	public void alterFixCrit(int fixCrit) {
		this.fixCrit += fixCrit;
	}
	public void alterFixTough(int fixTough) {
		this.fixTough += fixTough;
	}
	
	
	
	public int getFixAttack() {
		return fixAttack;
	}

	public int getFixDefense() {
		return fixDefense;
	}

	public int getFixHit() {
		return fixHit;
	}

	public int getFixDodge() {
		return fixDodge;
	}

	public int getFixCrit() {
		return fixCrit;
	}

	public int getFixTough() {
		return fixTough;
	}



	public int getBuffCoefficient() {
		return buffCoefficient;
	}


	
	
	
}
